	//登录接口
	var LOGIN = "log.php";
	//上传接口
	var UPLOADING = "file.php";
	//默认用户名
	var USER = "admin";
	var VERSION = SUCCESS = DEVICE = 1;
	var SEVER = {
			url: LOGIN,
			type: 'POST',
			dataType: 'json',
			data: {device_id: DEVICE,version:VERSION,phonenumber:USER,password:""}
		};
	//登录
	$('#login_llf').click(function(e){
		SEVER.data.password = $('#password').val();
		llf_dl(SEVER);
	});	
	//上传
	$('#ajaxSubmit').click(function(e){
		 $("#formToUpdate").ajaxSubmit({
                    type:'post',
                    url:UPLOADING,
                    dataType:"json",
                    success:function(data){
                    	console.log(data);
                        if (data.state == 1) {
							location.href="Message.html";
						}else{
							alert("上传失败");
						}
                    },
                    error:function(XmlHttpRequest,textStatus,errorThrown){
                        console.log(XmlHttpRequest);
                        console.log(textStatus);
                        console.log(errorThrown);
                        alert(XmlHttpRequest.responseText);
                    }
                });
	});

	//登录回调
	function llf_dl(obj) {
		$.ajax(obj).done(function(data) {
			console.log(data);
			if (data.state == 1) {
				var a = '<a class="hiddenanchor" id="toregister"></a>';
				$('#tologin').before(a);
				location.href="#toregister";
			}else{
				alert("登录失败");
			}
		})
		.fail(function() {
			console.log("error");
			alert("登录失败");
		})
	}